import request from '@/utils/request'

export function getChannelList() {
  return request({
    url: '/deploy/channelList',
    method: 'post',
    data: '',
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function deleteChannel(row) {
  let data = {
    "name": row.name
  };
  return request({
    url: '/deploy/delChannel',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}

export function addChannel(row) {
  let data = {
    "name": row.name,
    "org": row.orgs
  };
  return request({
    url: '/deploy/addChannel',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
export function alertChannel(oldChannel, newChannel) {
  let data = []
  console.log(oldChannel,newChannel);
  data.push(oldChannel)
  data.push(newChannel)
  return request({
    url: '/deploy/alertChannel',
    method: 'post',
    data: JSON.stringify(data),
    headers: {
      "Content-Type": "application/json;charset=UTF-8"
    },
  })
}
